Made doc subcommand print duration
authorKalita Alexey <kalita.alexey@outlook.com>
Wed, 18 Jan 2017 19:37:52 +0000 (22:37 +0300)
committerKalita Alexey <kalita.alexey@outlook.com>
Wed, 18 Jan 2017 19:38:22 +0000 (22:38 +0300)
src/cargo/ops/cargo_rustc/job_queue.rs
tests/build-script.rs
tests/doc.rs
tests/rustdocflags.rs

index 23a71ae8d3edc56e32d27437d257e7effbb8628e..e40c82922a1f66dea0bc2a6890c474684023656a 100644 (file)
@@ -30,7 +30,6 @@ pub struct JobQueue<'a> {
     documented: HashSet<&'a PackageId>,
     counts: HashMap<&'a PackageId, usize>,
     is_release: bool,
-    is_doc_all: bool,
 }
 
 /// A helper structure for metadata about the state of a building package.
@@ -90,7 +89,6 @@ impl<'a> JobQueue<'a> {
             documented: HashSet::new(),
             counts: HashMap::new(),
             is_release: cx.build_config.release,
-            is_doc_all: cx.build_config.doc_all,
         }
     }
 
@@ -209,12 +207,11 @@ impl<'a> JobQueue<'a> {
                                    duration.as_secs(),
                                    duration.subsec_nanos() / 10000000);
         if self.queue.is_empty() {
-            if !self.is_doc_all {
-                cx.config.shell().status("Finished", format!("{} [{}] target(s) in {}",
-                                                                  build_type,
-                                                                  opt_type,
-                                                                  time_elapsed))?;
-            }
+            let message = format!("{} [{}] target(s) in {}",
+                                  build_type,
+                                  opt_type,
+                                  time_elapsed);
+            cx.config.shell().status("Finished", message)?;
             Ok(())
         } else if let Some(e) = error {
             Err(e)
index 371434c494ea60064de585bbf51c549ab8a87254..93499f4162cf9c195e7f56562435de319148732d 100644 (file)
@@ -520,6 +520,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
                        .with_stderr("\
 [DOCUMENTING] foo v0.5.0 (file://[..])
 [RUNNING] `rustdoc [..]`
+[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
 "));
 
     File::create(&p.root().join("src/main.rs")).unwrap()
index 9f9d349f324bc966af72127beae87a1b1c025335..f58d57db0bfad23965e17b7aa635064f05850125 100644 (file)
@@ -28,6 +28,7 @@ fn simple() {
                 execs().with_status(0).with_stderr(&format!("\
 [..] foo v0.0.1 ({dir})
 [..] foo v0.0.1 ({dir})
+[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
 ",
         dir = path2url(p.root()))));
     assert_that(&p.root().join("target/doc"), existing_dir());
@@ -71,6 +72,7 @@ fn doc_twice() {
     assert_that(p.cargo_process("doc"),
                 execs().with_status(0).with_stderr(&format!("\
 [DOCUMENTING] foo v0.0.1 ({dir})
+[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
 ",
         dir = path2url(p.root()))));
 
@@ -109,6 +111,7 @@ fn doc_deps() {
 [..] bar v0.0.1 ({dir}/bar)
 [..] bar v0.0.1 ({dir}/bar)
 [DOCUMENTING] foo v0.0.1 ({dir})
+[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
 ",
         dir = path2url(p.root()))));
 
@@ -255,6 +258,7 @@ fn doc_dash_p() {
 [..] b v0.0.1 (file://[..])
 [..] b v0.0.1 (file://[..])
 [DOCUMENTING] a v0.0.1 (file://[..])
+[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
 "));
 }
 
@@ -447,6 +451,7 @@ fn doc_release() {
                        .with_stderr("\
 [DOCUMENTING] foo v0.0.1 ([..])
 [RUNNING] `rustdoc [..] src[/]lib.rs [..]`
+[FINISHED] release [optimized] target(s) in [..]
 "));
 }
 
index aa91471a6d8c864fa69d80fb995bb11103225754..dd6c7f9703c29d03b0f94bc31e5922b9bad97422 100644 (file)
@@ -77,9 +77,12 @@ fn rerun() {
     assert_that(p.cargo("doc").env("RUSTDOCFLAGS", "--cfg=foo"),
                 execs().with_status(0));
     assert_that(p.cargo("doc").env("RUSTDOCFLAGS", "--cfg=foo"),
-                execs().with_status(0).with_stderr(""));
+                execs().with_status(0).with_stderr("\
+[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
+"));
     assert_that(p.cargo("doc").env("RUSTDOCFLAGS", "--cfg=bar"),
                 execs().with_status(0).with_stderr("\
 [DOCUMENTING] foo v0.0.1 ([..])
+[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
 "));
 }